<?php

/**
 * planning_charge filter form base class.
 *
 * @package    gesp
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Baseplanning_chargeFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plnchg_prj_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => true)),
      'plnchg_plntac_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('tache_planning'), 'add_empty' => true)),
      'plnchg_user_id'          => new sfWidgetFormFilterInput(),
      'plnchg_date'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'plnchg_charge_prevue'    => new sfWidgetFormFilterInput(),
      'plnchg_charge_consommee' => new sfWidgetFormFilterInput(),
      'plnchg_charge_restante'  => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'plnchg_prj_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('projet'), 'column' => 'prj_id')),
      'plnchg_plntac_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('tache_planning'), 'column' => 'plntac_id')),
      'plnchg_user_id'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'plnchg_date'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'plnchg_charge_prevue'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'plnchg_charge_consommee' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'plnchg_charge_restante'  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('planning_charge_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'planning_charge';
  }

  public function getFields()
  {
    return array(
      'plnchg_id'               => 'Number',
      'plnchg_prj_id'           => 'ForeignKey',
      'plnchg_plntac_id'        => 'ForeignKey',
      'plnchg_user_id'          => 'Number',
      'plnchg_date'             => 'Date',
      'plnchg_charge_prevue'    => 'Number',
      'plnchg_charge_consommee' => 'Number',
      'plnchg_charge_restante'  => 'Number',
    );
  }
}
